package ConnectionsCommands;

import java.util.HashMap;

/**
 * Hash which contains the executors of the received commands.
 *
 * @author Rodrigo Martins Racanicci
 */
public class ConnectionHashCommand extends HashMap<String, ConnectionCommand> {

    public ConnectionHashCommand() {
        super(20);

        super.put("IAA", new ConnectionCommandIAA());
        super.put("LsPeers", new ConnectionCommandLsPeers());
        super.put("RegisterFile", new ConnectionCommandRegisterFile());
        super.put("Close", new ConnectionCommandClose());
        super.put("LsX", new ConnectionCommandLsX());
        super.put("IANA", new ConnectionCommandIANA());
        super.put("NewFile", new ConnectionCommandNewFile());
        super.put("RemoveFile", new ConnectionCommandRemoveFile());
        super.put("RequestPeer", new ConnectionCommandRequestPeer());
        super.put("LockFile", new ConnectionCommandLockFile());
        super.put("UnlockFile", new ConnectionCommandUnlockFile());
    }

    /**
     * Put operations not allowed on ConnectionHashCommand. IllegalAccessError will be thrown.
     *
     * @param key   not allowed.
     * @param value not allowed.
     *
     * @return not allowed.
     */
    @Override
    public ConnectionCommand put(String key, ConnectionCommand value) {
        throw new IllegalAccessError("Operation not supported");
    }
}
